#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;

const int N = 1e6 + 10;

int n;
int prime[N], cnt;
bool st[N];

void init(int n){
    for(int i = 2; i <= n; i ++){
        if(!st[i]) prime[cnt++] = i;

        for(int j = 0; prime[j] <= n / i; j ++){
            st[prime[j] * i] = true;
            if(i % prime[j] == 0) break;
        }
    }
}


int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    scanf("%d", &n);
    init(n);

    for(int i = 0; i < cnt; i ++){\
        int p = prime[i];
        int s = 0;
        for(int j = n; j; j /= p) s += j/p;
        printf("%d %d\n", prime[i], s);
    }

    return 0;
}